package com.hs.srm.admin.modules.sampletest.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.hs.srm.admin.modules.sampletest.dao.ExamineGoodsDao;
import com.hs.srm.admin.modules.sampletest.service.ExamineGoodsService;
import com.hs.srm.admin.modules.orders.entity.StockEntity;
import com.hs.srm.base.common.utils.QueryParam;
import com.hs.srm.common.utils.PageUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service("examineGoodsService")
public class ExamineGoodsServiceImpl extends ServiceImpl<ExamineGoodsDao, StockEntity> implements ExamineGoodsService {

    //货物list
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        //发货单号
        String deliverNo = (String) params.get("deliverNo");
        //订单号
        String poNo = (String) params.get("poNo");
        //收货单号
        String mblnr = (String) params.get("mblnr");
        Page<StockEntity> page = this.selectPage(
                new QueryParam<StockEntity>(params).getPage(),
                new EntityWrapper<StockEntity>()
                        .like(StringUtils.isNotBlank(deliverNo), "deliver_no", deliverNo)
                        .like(StringUtils.isNotBlank(poNo), "po_no", poNo)
                        .like(StringUtils.isNotBlank(mblnr), "mblnr", mblnr)
        );
        return new PageUtils(page);
    }
}
